package coms.delegates;

import EJB.EJBLocator;
import coms.dto.ConferenceItem;
import coms.dto.Keyword;
import coms.ejb.KeywordBeanRemote;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class KeywordDelegate implements IDelegate<Keyword> {

    private KeywordBeanRemote keywordBean;
    
    public KeywordDelegate() {
        try {
            this.keywordBean = EJBLocator.lookupKeywordBean();
        } catch (Exception ex) {
            Logger.getLogger(KeywordDelegate.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public boolean create(Keyword keyword) {
        keywordBean.create(keyword);
        return true;
    }

     @Override
    public boolean delete(Keyword keyword) {
        boolean deleted = keywordBean.delete(keyword);
        return deleted;
    }

     @Override
    public boolean update(Keyword keyword) {
        keywordBean.update(keyword);
        return true;
    }

    @Override
    public List<Keyword> search(Keyword t) throws Exception {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public List<Keyword> findAll() throws Exception {
        return keywordBean.findAll();
    }
    
     @Override
    public Keyword getById(int id) throws Exception {
       return keywordBean.getById(id);
    }
}
